<?php

/**
 * This is the model class for table "business_district".
 *
 * The followings are the available columns in table 'business_district':
 * @property integer $id ID
 * @property string $name 分类名
 */
class BusinessDistrict extends ActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return BusinessDistrict the static model class
	 */
	public static function model($className=__CLASS__) {
		return parent::model($className);
	}
	
	public function getMdcClass() {
		return 'application.models.metadata.BusinessDistrictMetadata';
	}
	
	public function getDistrictIds() {
		$ids = array();
		foreach ($this->districts as $one) {
			$ids[] = $one->district_id;
		}
		return $ids;
	}
	
	public function getDistrictObjs() {
		$criteria = new CDbCriteria();
		$criteria->addInCondition('id', $this->getDistrictIds());
		return CommonDistrict::model()->findAll($criteria);
	}
}